package vdc.model.logging;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;

public class LogAppender extends AppenderSkeleton
{

	@Override
	public synchronized void append(LoggingEvent event)
	{
		System.out.println("Event level : " + event.getLevel().toString());

		if (event.getMessage() instanceof Exception)
		{
			System.out.println("<<Exception>>");
			Exception e = (Exception) event.getMessage();
			e.printStackTrace(System.out);
		} else if (event.getMessage() instanceof String)
		{
			String e = (String) event.getMessage();
			System.out.println("<<STRING>>  " + e);
		} else
		{
			System.out.println("<<OTHER ERROR>>"
					+ event.getMessage().toString());
		}

	}

	@Override
	public void close()
	{
		// TODO Auto-generated method stub

	}

	@Override
	public boolean requiresLayout()
	{
		// TODO Auto-generated method stub
		return false;
	}

}
